﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="complaintEdit.aspx.cs"
    Inherits="PeisongWeb.admin.complaintEdit" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>投诉管理 - 想购网长期采购物流配送系统</title>
    <!--#include file="style.inc"-->

    <script type="text/javascript" language="javascript" src="../app_common/scripts/jquery-1.3.2.js"></script>

    <script type="text/javascript">
        function chkFm() {
            if ($("#ddl_buyer").val() == "") {
                $("#val_buyer").show();
                return false;
            }
            if ($("#ddl_ComplainttypeRoot").val() == "") {
                $("#val_complainttype").show();
                return false;
            }
            if ($("#ddl_subDepartmentId").val() == "") {
                $("#val_subDepartmentId").show();
                return false;
            }
            if ($("#ddl_subDepartmentId").val() == "") {
                $("#val_subDepartmentId").show();
                return false;
            }
            if ($("#ddl_result").val() == "") {
                $("#val_result").show();
                return false;
            }
            if ($("#ddl_ComplainttypeRoot").val() == "1" || $("#ddl_ComplainttypeRoot").val() == "2" || $("#ddl_ComplainttypeRoot").val() == "3") {
                if ($("#input_productNo").val() == "") {
                    $("#hid_proId").val("");
                    $("#sp_productName").html("");
                    $("#val_proNo").show();
                    $("#input_productNo").focus();
                    return false;
                }
                if ($("#ddl_sellerName").val() == "") {
                    $("#val_seller").show();
                    return false;
                }
            }
            if ($("#hid_proId").val() == "0") {
                $("#val_proNo").show();
                $("#input_productNo").focus();
                return false;
            }
            return true;
        }

        function getProductName() {
            if ($("#ddl_ComplainttypeRoot").val() == "1" || $("#ddl_ComplainttypeRoot").val() == "2" || $("#ddl_ComplainttypeRoot").val() == "3") {
                if ($("#input_productNo").val() == "") {
                    $("#hid_proId").val("");
                    $("#sp_productName").html("");
                    $("#val_proNo").html("请填写商品编号！");
                    $("#val_proNo").show();
                    $("#input_productNo").focus();
                    return false;
                }
            }
            if ($("#input_productNo").val() != null && $("#input_productNo").val() != "") {
                //根据商品编号找到对应的商品Id、商品名称、供应商Id
                $.ajax({
                    url: 'product.ashx',
                    type: 'GET',
                    dataType: "json",
                    async: false,
                    data: { Param: "getByProductNo", ProductNo: $("#input_productNo").val() },
                    cache: false,
                    success: function(json) {
                        if (json.length > 0) {
                            $(json).each(function(entryIndex, entry) {
                                $("#sp_productName").html(entry["productName"]);
                                $("#hid_proId").val(entry["productId"]);
                                $("#val_proNo").hide();
                                return true;
                            })
                        }
                        else {
                            //alert("对不起，您输入的商品编号不存在，请重新输入！");
                            $("#hid_proId").val(0);
                            $("#val_proNo").html("对不起，您输入的商品编号不存在，请重新输入！");
                            return false;
                        }
                    }
                });
            }
            return true;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sm1" runat="server">
    </asp:ScriptManager>
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin_main" style="margin: 10px 0 0 10px;">
        <ext:Panel ID="panel_Title" runat="server" Title="添加投诉记录" BodyStyle="padding:5px 5px 0"
            Width="650" Frame="true" ButtonAlign="Center">
            <Body>
                <ext:Panel ID="Panel1" runat="server">
                    <Body>
                        <ext:ColumnLayout ID="ColumnLayout1" runat="server">
                            <ext:LayoutColumn ColumnWidth=".5">
                                <ext:Panel ID="Panel4" runat="server" Border="false" Header="false">
                                    <Body>
                                        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
                                            <Triggers>
                                                <asp:PostBackTrigger ControlID="btn_Save" />
                                            </Triggers>
                                            <ContentTemplate>
                                                <div id="admin_edit_content">
                                                    <ul>
                                                        <li>
                                                            <label>
                                                                投诉日期
                                                            </label>
                                                            <ext:DateField ID="ext_ComplaintDt" runat="server" AllowBlank="true" ReadOnly="true"
                                                                Width="100" />
                                                        </li>
                                                        <li>
                                                            <li>
                                                                <label>
                                                                    客户名称
                                                                </label>
                                                                <asp:DropDownList ID="ddl_buyer" runat="server" DataTextField="company" DataValueField="companyId">
                                                                </asp:DropDownList>
                                                                <span id="val_buyer" style="color: Red; display: none;">请选择投诉客户名称！</span> </li>
                                                            <li>
                                                                <label>
                                                                    投诉类别
                                                                </label>
                                                                <asp:DropDownList ID="ddl_ComplainttypeRoot" runat="server" DataTextField="ctname"
                                                                    DataValueField="ctid" AutoPostBack="true" OnSelectedIndexChanged="ddl_ComplainttypeRoot_SelectedIndexChanged">
                                                                </asp:DropDownList>
                                                                <asp:DropDownList ID="ddl_ComplainttypeSub" runat="server" AutoPostBack="true" DataTextField="ctname"
                                                                    DataValueField="ctid" OnSelectedIndexChanged="ddl_ComplainttypeSub_SelectedIndexChanged"
                                                                    Width="176px">
                                                                </asp:DropDownList>
                                                                <span id="val_complainttype" style="color: Red; display: none;">请选择投诉类别！</span>
                                                            </li>
                                                            <li>
                                                                <label>
                                                                    处理结果
                                                                </label>
                                                                <asp:DropDownList ID="ddl_result" runat="server" DataTextField="name" DataValueField="xm">
                                                                </asp:DropDownList>
                                                                <span id="val_result" style="color: Red; display: none;">请选择处理结果！</span>
                                                            </li>
                                                            <li>
                                                                <label>
                                                                    投诉产品编号
                                                                </label>
                                                                <input runat="server" style="width: 110px" runat="server" id="input_productNo" onblur='getProductName();'
                                                                    onafterpaste='getProductName();' />
                                                                <span id="val_proNo" style="color: Red; display: none;">请填写商品编号！</span> <span id="sp_productName"
                                                                    runat="server"></span>
                                                                <input runat="server" type="hidden" id="hid_proId" />
                                                            </li>
                                                            <li runat="server" id="li_de1">
                                                                <label>
                                                                    责任部门
                                                                </label>
                                                                <asp:Label ID="lbl_department" runat="server"></asp:Label>
                                                                <asp:HiddenField ID="hid_departmentId" runat="server" Value="0" />
                                                                <asp:Label ID="lbl_DepartmentItemId" runat="server"></asp:Label>
                                                                <asp:HiddenField ID="hid_DepartmentItemId" runat="server" Value="0" />
                                                            </li>
                                                            <li>
                                                                <label>
                                                                    责任人
                                                                </label>
                                                                <asp:DropDownList Width="100px" ID="ddl_responsibleid" runat="server" DataTextField="username"
                                                                    DataValueField="adminid">
                                                                </asp:DropDownList>
                                                                <asp:Literal runat="server" ID="lit_resName"></asp:Literal>
                                                                <span id="Span2" style="color: Red; display: none;">请选择责任人！</span> </li>
                                                            <li>
                                                                <label>
                                                                    责任供应商
                                                                </label>
                                                                <asp:DropDownList ID="ddl_sellerName" runat="server" DataTextField="company" DataValueField="companyId">
                                                                </asp:DropDownList>
                                                                <span id="val_seller" style="color: Red; display: none;">请选择责任供应商！</span> </li>
                                                            <li>
                                                                <label>
                                                                    严重级别
                                                                </label>
                                                                <asp:Label ID="lbl_severityLevel" runat="server"></asp:Label>
                                                                <asp:HiddenField ID="hid_severityLevel" runat="server" />
                                                            </li>
                                                            <li>
                                                                <label>
                                                                    备注
                                                                </label>
                                                                <asp:TextBox TextMode="MultiLine" runat="server" ID="txt_remarks" Width="310px"></asp:TextBox>
                                                            </li>
                                                            <li>
                                                                <label>
                                                                    &nbsp;</label>
                                                                <asp:Button runat="server" ID="btn_Save" Text="保　存" OnClick="btn_Save_Click" OnClientClick="return chkFm()" />
                                                                <input type="button" id="btn_Return" value="返　回" onclick="window.location.href='complaintList.aspx'" />
                                                            </li>
                                                    </ul>
                                                </div>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </Body>
                                </ext:Panel>
                            </ext:LayoutColumn>
                        </ext:ColumnLayout>
                    </Body>
                </ext:Panel>
            </Body>
        </ext:Panel>
    </div>
    <asp:HiddenField ID="hid_resId" runat="server" Value="0" />
    </form>
</body>
</html>
